# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
import time


class TodaymoviePipeline(object):
    def process_item(self, item, spider):
        today = time.strftime("%Y-%m-%d", time.localtime())
        filename = "武汉汉街万达广场店" + today + ".txt"
        with open(filename, 'a+', encoding='utf-8') as fp:
            fp.write(
                "%s %s %s %s \r\n" % (item["movieTitleCn"], item["movieTitleEn"], item["director"], item["runtime"]))

    # return item
